<template>
	<view class="trade">
		<van-tabs :ifbuy="true" :active="active" color="#3286f1" @change="onChangeTab">
		<view class="trade-titel">
			<text>状态</text>
			<text>收款地址</text>
			<text>数量</text>
		</view>
		  <van-tab title="积分"><integral></integral></van-tab>
		  <van-tab title="WNCT"><wnct></wnct></van-tab>
		</van-tabs>
	</view>
</template>
<script>
	import integral from './integral.vue'
	import wnct from './wnct.vue'
	export default {
		data() {
			return {
				active: 0,
				scrollTop: 0
			}
		},
		onShow () {
		},
		onPullDownRefresh() {
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			onChangeTab (e) {
				this.active = e.detail.index;
				uni.createSelectorQuery().selectViewport().scrollOffset(res => {
				  this.scrollTop = res.scrollTop
				}).exec();
				uni.pageScrollTo({
					scrollTop: this.scrollTop,
					duration: 0
				})
			},
		},
		components: {
			integral,
			wnct
		}
	}
</script>
<style scoped lang="scss">
	.trade {
		&-titel {
			position: fixed;
			top: 44px;
			left: 0;
			right: 0;
			z-index: 1;
			display: flex;
			padding: 0 30upx;
			height: 24px;
			line-height: 24px;
			color: #9b9b9b;
			background-color: #f2f2f2;
			text {
				display: block;
				min-width: 300upx;
			}
		}	
	}
</style>
